﻿using System;
using System.Globalization;
using System.Windows.Data;
namespace StockholmsStad.Windows.UI.Infrastructure.Converters
{
    public class NullableIntToNAStringConverter : IValueConverter
    {
        #region IValueConverter Members

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (targetType != typeof(string))
                throw new InvalidOperationException("The target must be a string");

            if (value == null)
                return "N/A";

            return value;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
